// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from '../router'
import ElementUI from 'element-ui'
import '../../node_modules/element-ui/lib/theme-chalk/index.css'
import axios from 'axios'
import vueAxios from 'vue-axios'
import Vuex from 'vuex'

Vue.config.productionTip = false

// router.start(App,"#app");
/* eslint-disable no-new */
Vue.use(ElementUI,axios,vueAxios)
Vue.use(Vuex)

axios.defaults.timeout=5000;
axios.defaults.baseUrl='http://localhost';
Vue.prototype.axios=axios;

let store = new Vuex.Store({
  state:{totalNum:0.01},
  getters:{
  	getTotal(state){
      return state.totalNum
  	}
  },
  mutations:{
  	//同步操作
  	increment(state,num){
  		state.totalNum+=num
  	},
  	decrement(state,num){
  		state.totalNum-=num
  	}
  },
  actions:{
  	//异步操作
  	increase(context,num){
      context.commit('increment',num)
  	}
  }
})
//事件中央线
let bus=new Vue();
Vue.prototype.bus=bus;

const app=new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})


